package de.wellenblau.objectGetter
{
	import flash.events.Event;
	import flash.events.ProgressEvent;
	import flash.net.URLLoader;
	
	public class xmlGetter extends objectGetter
	{
		//XML URLLoader
		private var _xmlLoader:URLLoader;
				
		public function xmlGetter(scope:Object, onComplete:Function, path:String)
		{
			//init objectGetter
			super(scope,onComplete,path);
			
			//config XML-Parser
			XML.ignoreComments=true;
			XML.ignoreWhitespace=true;
			
			//Load XML
			_xmlLoader = new URLLoader();
			_xmlLoader.addEventListener(Event.COMPLETE, onResponse);
			_xmlLoader.addEventListener(ProgressEvent.PROGRESS, onProgress);
			_xmlLoader.load(_myURL);
		}
		
		private function onResponse(e:Event):void
		{
			//get xml and
			var x:XML = new XML(e.target.data);
			//send it back
			callback([x]);
		} 
	}
}